
package com.dps.omc.service.impl;
import com.dps.omc.model.Task;
import com.dps.omc.model.User;
import com.dps.common.utils.IdGenerator;
import com.dps.omc.model.TaskLog;
import com.dps.omc.service.ITaskLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dps.common.service.impl.AbstractPageService;
import com.dps.omc.dao.ITaskLogDAO;

@SuppressWarnings("unchecked")
@Service("TaskLogServiceImpl")

public class TaskLogServiceImpl extends AbstractPageService<ITaskLogDAO,TaskLog> implements ITaskLogService {

	@Autowired
	private ITaskLogDAO taskLogDAO;
	@Override
	public boolean getEnableDataPerm() {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public ITaskLogDAO getDao() {
		return taskLogDAO;
	}

	@Override
	public void createLog(Task task, User lastModified) {
		TaskLog taskLog = new TaskLog();
		taskLog.setId(IdGenerator.createNewId());
		taskLog.setTaskId(task.getId());
		taskLog.setAgentId(task.getAgentId());
		taskLog.setJobId(task.getJobId());
		taskLog.setClientIp(task.getClientIp());
		taskLog.setBizUnit(task.getBizUnit());
		taskLog.setBizType(task.getBizType());
		taskLog.setGroupType(task.getGroupType());
		taskLog.setReturnMsg(task.getReturnMsg());
		taskLog.setStatus(task.getStatus());
		taskLog.setStartDate(task.getStartDate());
		taskLog.setEndDate(task.getEndDate());
		taskLog.setNote(task.getNote());
		taskLog.setIsTimer(task.getIsTimer());
		taskLog.setTemplateId(task.getTemplateId());
		taskLog.setArtifactId(task.getArtifactId());
		taskLog.setSeq(task.getSeq());
		taskLog.setCreaterId(task.getCreaterId());
		taskLog.setCreaterName(task.getCreaterName());
		taskLog.setTeam(task.getTeam());
		taskLog.setNodeId(task.getNodeId());
	  //taskLog.setLastModifiedTime(task.getLastModifiedTime());
		taskLog.setArtifactId(task.getArtifactId());
		taskLog.setLastModifiedId(task.getLastModifiedId());
		taskLog.setLastModifiedName(task.getLastModifiedName());
		taskLog.setLogFileId(task.getLogFileId());
		this.add(taskLog);
	}
}
